package com.example.luozizhao.eprxdemo.base.presenter;

import com.example.luozizhao.eprxdemo.base.view.BaseView;

import io.reactivex.disposables.CompositeDisposable;
import io.reactivex.disposables.Disposable;

/**
 * Created by luozizhao on 2018/5/16.
 */

public class BasePresenter<T extends BaseView> implements IPresenter<T> {

    protected T mView;
    private CompositeDisposable compositeDisposable;


    public void addSubscribe(Disposable disposable) {
        if (compositeDisposable == null) {
            compositeDisposable = new CompositeDisposable();
        }
        compositeDisposable.add(disposable);
    }


    @Override
    public void attach(T t) {
        this.mView = t;
    }

    @Override
    public void detach() {
        this.mView = null;
    }
}
